﻿using Bigway.Common.Models.DbModels;
using SqlSugar;

namespace Benefactor.Models.DbModels;

public class IssuedBenefitsCard: DeletableEntity
{
    [SugarColumn(IsNullable = false)]
    public string BenefitsCardId { get; set; }

    [SugarColumn(IsNullable = false)]
    public string CardNo { get; set; }

    [SugarColumn(IsNullable = false)]
    public string UserId { get; set; }

    [SugarColumn(IsNullable = false)]
    public DateTime IssueTime { get; set; } = DateTime.UtcNow;

    [SugarColumn(IsNullable = false)]
    public DateOnly ValidFrom { get; set; }

    [SugarColumn(IsNullable = false)]
    public DateOnly ValidTo { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(BenefitsCardId))]
    public BenefitsCard? BenefitsCard { get; set; }

    [Navigate(NavigateType.OneToMany, nameof(Voucher.IssuedBenefitsCardId))]
    public List<Voucher>? Vouchers { get; set; }
}